/* IE6 flicker fix
-------------------------------------------------- */
try { document.execCommand("BackgroundImageCache", false, true); } catch(err){}
jQuery.fn.hasClass = function(c) { return this.is('.'+c) };
function g(r){ return document.getElementById(r); }

jQuery(function() {

	//Header select
	jQuery('.nav01 p.trigger').bind('click', function(){
		jQuery('#nav01 p.trigger A').toggleClass('active');
		jQuery('.dropdown01', this.parentNode).slideToggle();
		return false;
	});
	jQuery('.nav02 p.trigger').bind('click', function(){
		jQuery('#nav02 p.trigger A').toggleClass('active');
		jQuery('.dropdown02', this.parentNode).slideToggle();
		return false;
	});

	jQuery('.project-desc div.info01 a.desc').bind('click', function(){
		jQuery('a.desc').toggleClass('active');
		jQuery('a.video').removeClass('active');
		jQuery('#text').slideToggle();
		jQuery('#video').css('display','none');
		return false;
	});
	jQuery('.project-desc div.info01 a.video').bind('click', function(){
		jQuery('a.video').toggleClass('active');
		jQuery('a.desc').removeClass('active');
		jQuery('#video').slideToggle();
		jQuery('#text').css('display','none');
		
		return false;
	});
	
})

jQuery( document ).ready( function ( $ ) {
	// Add first and last menu item classes
	$('div.dropdown01 li:last-child, div.dropdown02 li:last-child').addClass( 'last' );
});

jQuery(window).load(function(){
	$("DIV.box01").backgroundScale({
		imageSelector: ".backgound-image",
		centerAlign: true,
		containerPadding: 100
	});
});

$.fn.cycle.defaults.timeout = 6000;
$(function() {
    $('.projects-list-container').cycle({
        pager:  '#nav',
		fx:     'fade',
		speed:   600,
		timeout: 6000,
		pause:   1,
		fx:     'scrollHorz',
		cleartype:  true,
	    cleartypeNoBg:  true,
        next:    '#next',
        prev:    '#prev',
        pagerAnchorBuilder: pagerFactory
    });
	function pagerFactory(idx, slide) {
        var s = idx > 2 ? ' style="display:none"' : '';
        return '<li'+s+'><a href="#"><span>'+(idx+1)+'</span></a></li>';
    };
});

//Slide edasi-tagasi

$(function() {
    $('.scroll-cont').cycle({
		fx:     'scrollHorz', 
		prev:   '.prev', 
		next:   '.next', 
		timeout: 0,
	    nowrap:  1,
        pagerAnchorBuilder: pagerFactory
    });
	function pagerFactory(idx, slide) {
        var s = idx > 2 ? ' style="display:none"' : '';
        return '<li'+s+'><a href="#"><span>'+(idx+1)+'</span></a></li>';
    };
});

//Slide üles-alla
/*
$(function() {
    $('.scroll-cont').cycle({
		fx:     'scrollVert', 
		prev:   '.left', 
		next:   '.right', 
		timeout: 0,
	    nowrap:  1,
        pagerAnchorBuilder: pagerFactory
    });
	function pagerFactory(idx, slide) {
        var s = idx > 2 ? ' style="display:none"' : '';
        return '<li'+s+'><a href="#"><span>'+(idx+1)+'</span></a></li>';
    };
});
*/

$(function() {
  if($(document).height() <= $(document).height()) {
    $('#project-item, .scroll-cont').css({ 'height': ($(document).height()) });
    $('#project-item .scroll-cont').css({ 'width': ($(document).width()) });

    $(window).resize(function(){
      $('#project-item .scroll-cont').css({ 'height': ($(document).height()) });
      $('#project-item .scroll-cont').css({ 'height': ($(document).width()) });

    });
  }
});